export default {
    state: {
        cartList: [
            {
            "count": 9,//数量
            "selected": true,//是否选中
            "promId": 0,//id
            "imageUrl":"https://img1.baidu.com/it/u=2006247858,1733448086&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",//商品图片路径
            "name":"胡桃",//商品信息
            "price":188//商品单价
        }, 
        {
            "count": 3,//数量
            "selected": false,//是否选中
            "promId": 1,//id
            "imageUrl":"https://img0.baidu.com/it/u=973022141,143586184&fm=26&fmt=auto",//商品图片路径
            "name":"小派蒙",//商品信息
            "price":222//商品单价
        }, 
        {
            "count": 6,//数量
            "selected": false,//是否选中
            "promId": 2,//id
            "imageUrl":"https://img1.baidu.com/it/u=4146082130,715828257&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=667",//商品图片路径
            "name":"神郭嘉-时代的6万5",//商品信息
            "price":6500//商品单价
        },
    ]
    },
    actions: {},
    mutations: {
        //改变选中状态
        changeCheck(state,{selected,index}){
            state.cartList[index].selected=selected
        },
        //底部选择按钮
        changeAllCheck(state,selected){
            state.cartList.forEach(item=>item.selected=selected)
        },
        //增加或者减少
        handlerChangeCount(state,{addOrdel,index}){
            if(addOrdel){
				state.cartList[index].count+=1
			}else{
				if(state.cartList[index].count>1){
					state.cartList[index].count-=1
				}else{
					state.cartList.splice(index,1)
				}
			}
        }
    },
    getters: {}
}